/**
 * Created by John on 2016/7/8.
 */
var mongo = new Mongo("localhost");
var wordsDB = mongo.getDB("BeginningMongoDB");
wordsColl = wordsDB.getCollection("word_stats");

var results = wordsColl.distinct('size');
print("Sizes of words");
printjson(results);

results = wordsColl.distinct('size', {first: 'a'});
print("Sizes of words starting with A");
printjson(results);

results = wordsColl.distinct('last', {'stats.vowels': 2});
print("Words with 2 vowels end with letter:");
printjson(results);

results = wordsColl.distinct('first', {last: 'u'});
print("Words ending in U start with letter:");
printjson(results);

results = wordsColl.distinct('stats.consonants', {size: {$gt: 10}});
print("Number of consonants in words longer than 10 characters:");
printjson(results);